﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using StyleMVVM.DependencyInjection;

namespace StyleMVVM.Data.Activation
{
	public delegate object ActivationStrategyDelegate(
		IInjectionContext injectionContext, [ReadOnlyArray] object[] constructorParams);

	/// <summary>
	/// Represents a class that can activate an object (used by the activation service.
	/// </summary>
	public interface IActivationStrategy
	{
		/// <summary>
		/// Container this strategy is associated with
		/// </summary>
		IDependencyInjectionContainer Container { get; set; }

		/// <summary>
		/// Activation service this strategy is associated with
		/// </summary>
		IActivationService ActivationService { get; set; }

		/// <summary>
		/// should this object type be registered for suspension
		/// </summary>
		bool Suspendable { get; set; }

		/// <summary>
		/// should this type be registered for messages
		/// </summary>
		bool RegisterHandlers { get; set; }

		/// <summary>
		/// Initialize the strategy
		/// </summary>
		void Initialize();

		/// <summary>
		/// Are there any pipeline handlers asscoiated with this strategy
		/// </summary>
		IList<object> PipelineHandlers { get; set; }

		/// <summary>
		/// Activate an instance of the object
		/// </summary>
		/// <param name="container">DI container</param>
		/// <param name="injectionContext">injection context</param>
		/// <param name="constructorParams">parameters to pass to the constructor</param>
		/// <returns>instance</returns>
		object Activate(IInjectionContext injectionContext, [ReadOnlyArray] object[] constructorParams);

		/// <summary>
		/// Returns a delegate that will activate the strategy
		/// </summary>
		/// <returns></returns>
		ActivationStrategyDelegate GetActivationStrategyDelegate();
	}
}